' Test ai (The last test done in SB, revised for SB1) test some new string functions 2021-02-28 
' SB test originally done 2018-09-15

' The main test here is testing if Split converts SB's array string to SB1's array string using Split.
' You don't have to Set to Get, Split sets up an Astring from a literal "data" string.
' That's the point of this exercise, but we show alternate ways to get a space in a variable and
' more talk about handling empty strings from ? Enters for Input statements.

' All this fuss over dang empty strings lead to creation of commands n? and ?n to return 0
' if Input gets empty string from user. See 2nd Test ai Mod...

' SB's space delimited list of months, SB only worked with Space delimited Astrings.
months "January February March April May June July August September October November December

' Set up our Split delimiter for SB1 that can Split any delimited string into something 
' like an array, an Astring.

' The following line ends 1 space out from " , yep! not easily discernible.
1Space " 
' Because it's so weird test it's length:
lenOf1Space Len 1Space
. lenOf1Space; is the length of 1Space variable.
' make months an Astring for Get (works)
'12Months split months, 1Space

' An alternate way of assignment of 1 space: 
1Space2 SPC 1
lenOf1Space2 Len 1Space
. lenOf1Space2; is the length of another 1 space variable.
'12Months split months, 1Space2
' Works!

' Oh heck let's try splitting with a literal 1 space between comma and invisible end of line!
' Make months an Astring for Get, with literal single space
'12Months split months, 
' Nope! that's not working? too tricky anyway

' Try this because it tests a new String Function:
sp1 chr 32
' Make months an Astring for Get, with space generated from Chr function.
12Months split months, sp1
'Yes! works, probably most sensible way? Really leery about using literals in String Functions.

'OK now try a Get
get Jan, 12Months, 1
. (Hopefully) January should end this line for month 1 of 12 > ;Jan
.
. I can name the month with just it's number:
[
	? Enter month number to name; nMonth
	
	'pretty much have to do this first before using nMonth or any ? Input variable.
	isEmpty $= nMonth,
	
	' Check if nothing there, the following turned out to be time consuming chore!
	' But I am trying to test new functions as I go.
	
	' The main test was to see that Split transformed a string into an Astring that we can get 
	' items from as if it were an array, I love that it works!
	
	if isEmpty
	
		'confirm with user a quit?
		? Do you want to quit? enter y for yes;yes
		
		' again with the empty check
		isEmpty $= yes,
		
		'We need to check for empty before using yes variable, just skip through
		' if isEmpty because user did not specifically say y for yes.
		' I am surprised that worked! There is nothing between the if line and the el line, nice!!!
		if isEmpty
		el
			yesQuit $= yes,y
			jmp yesQuit
		fi
	el
		if nMonth > 0 and nMonth < 13
			Get month, 12months, nMonth
			. The ;nMonth ;th month is ;month
		el
			. Sorry, the month range is 1 to 12. Try again.
		fi
		.
	fi
]